package produce;

import java.util.Random;

public class producer extends Thread{
	private Repository<BaoZi> zhenglong;
	public producer(Repository<BaoZi> zhenglong){
		this.zhenglong =zhenglong;
		
	}

	 public void run() {
		 String[] names={"菜包","肉包","豆沙包","无所谓"};
		 int c=0;
		 Random rd=new Random();
		 while(true){
			 c++;
		 BaoZi bz=new BaoZi(c,names[i]);
		 zhenglong.save(bz);
		 System.out.println("生产了"+c+"号"+names[i]);
		 try{
			 Thread.sleep(500);
		 }catch (InterruptedException e) {
			 e.printStackTrace();
		 }
		 }
		

	}

}
